package model.client.responsehandler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import server.response.AllIdResponseMessage;

/**
 * @Description 服务器传到客户端当前所有在线用户的id,以便客户端选择建立群聊的用户
 * @author czc
 */
public class AllIdResponseHandler extends SimpleChannelInboundHandler<AllIdResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, AllIdResponseMessage msg) throws Exception {
//        AttributeKey<String> name = AttributeKey.valueOf("name");
//        String userName = ctx.channel().attr(name).get();
//        System.out.println("Attribute:"+userName);
        /*
        list中的数据为空，String中存在每个在线用户的id
        但是String是从List的toString方法得来，AllIdRequestHandler中26行
        ????????疑问
         */
        System.out.println("List 当前在线用户为:" + msg.getAllId());
        System.out.println("String 当前在线用户为:" + msg.getAll());
        //System.out.println(allId);
    }
}
